<?php

class Galleries extends Eloquent {
   
    /**
     * The database table used by the model.
     *
     * @var string
     */
    protected $table = 'galleries';

    /**
     * The primary key for the model.
     *
     * @var string
     */
    protected $primaryKey = 'id';
    protected $fillable = array('name', 'description', 'active', 'userID_created','userID_modified');
    
    public function delete(array $options = array()) {
        $delete = parent::delete($options);
        $items = \GalleriesItems::where('galleryID',$this->id)->get();
        foreach($items as $key => $item)
        {
            $item->delete();
        }
        return $delete;
    }
   
}

